package com.itbbs.oss.controller;


import com.itbbs.oss.service.api.OssService;
import com.itbbs.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @program: bbs-system
 * @ClassName OssController
 * @description:oss用于头像存储
 * @author: 7
 * @create: 2021-06-04 12:12
 * @Version 1.0
 **/
@Api(tags = "oss头像文件存储")
@RestController
@RequestMapping("/users_oss")
public class OssController {

    @Resource
    private OssService ossService;

    @ApiOperation(value = "照片文件上传")
    @PostMapping("/upload")
    public Result<?> uploadOssFile(@RequestParam("file") MultipartFile file){

        String url = ossService.uploadFileAvatar(file);

        return Result.ok(url);
    }


}
